cleaned code and changed template routes