refactor app templates