Implemented thread safety in RegistrationRepository
Various cleanups