Cleanup. And fixed half of the functionalizing Entity search bug (same
bug in production)