Romans 6:17-18 — But God be thanked, that ye were the servants of sin, but ye have obeyed from the heart that form of doctrine which was delivered you.
Being then made free from sin, ye became the servants of righteousness.
that ye were = emphasis is on the contrast between what they were (servants of sin) and what they now are (servants of righteousness).
ye have obeyed = tense points back to the moment they believed — which accomplished permanent results
from the heart = voluntary and earnest
form = cast or mold — Believers are the molten material, gospel truth is the mold that shapes our character.
The change of masters (verse 18) results from faith and is accomplished by God (not by believers themselves).