Removed waiting state. Reimplemented state change logic.