added support for templates
moved main page handler to index page handler in controllers