moved state constants into class def. added prev-state var and set-state method.