Added some templates and some logic in controllers