Moved front end template logic into controllers