Global Cleanup and sorted Entity variables