Fix profile edit and search, clean up main