front end work and templates and state machine