updated createnewuser function