refactoring template app