Bug Fixes and templates working

Some bugs fixed such as login after moving code around from previous
commit, templates can now be added and selected when creating/editing a
page