added StateManager + tests