adding login and logout functions