Further implementation of event queue
Transitioned to state machine architecture