Implemented State Pattern