refactoring - templates, paths, helper funtions