refactoring PathTemplate controller