initial state encoding done, I think