Added code for login and session management