Added basic state machine framework
Adjusted states