Moved layout and loading templates to the views.