Detect when the users domain changes and save it back to the database
Enabled domain based profiles and other minor fixes