added controller specs
extracted javascript for routing and template rendering