Implemented logout functionality and restructured the template hierarchy