Beautify template and fix logout logic.

Closes #4