Made statemachine a boost shared pointer.
Added statemachine pointer to main.