Updated user registration/validation flow, added unit tests