refactored saving user reg