-- cleaning up the retrieve-entity function