Clean up the codes. Added a useful comment. TODO: include a state transition event. Windows not supporting CCEventDispatcher posing a few problems here.