Changed the main file so that when the user logs out, it redirects back to the main page. This ensures that it always goes to the correct page on login amongst other things.