Refactored login and registration with service objects.