changed directory structure and adding functions to template