Clean up code, including collection of "allResources" #3697