merged state changer into switch-case of main statemachine