refactored user registration and create user