updated code for user registration