Changes to removal of entities, tweaked variables