re-commit, created test for RegistrationService, also fixed a bug