finished login and logout functions