Added login and logout function