finished the implementation without applying the state design pattern