added functionality to register and login