Add redirection if the user is logged in.

- Add redirection if the user is logged on.
- Clean up code.