Added login and logout functions