refactor to use routes and views, remove view logic from root html