Added more code to simulate logging in