working on state model