tidy up routes and handle login process more gracefully