Implemented a state machine and the base state and object classes