cleaned up models, bugfix in state machine