Added code for registration and validating users.