Implemented user registration logic