added template directory method and abstract controller