refactored template manager and use of Tilt templating engine