refactored users register/login