now with statemachine and ui