Fix up some code on the main domains page
Code cleanup