Fixes on registration and ExternalLogin. Minor changes to architecture.