2014-06-23 | state machine initialized

state machine works now basiclly
2014-06-23 | some more clean up

code clean up, comments and layout