Created util.js which can house common utility functions; Moved session-checking login - validity is now checked everytime the route changes - #4