Added logout function
Template improvements