Coding for a desired state