intermin doesnt work at all
refactored statemachine, step 1
gofmt