added state machine and set timers to update functions