added login and logout mechanism