add all states. Refactor controller
implement more state mehtods
add some tests
Merge branch 'states' into sz/maintenancestate