app template refactor