Fix class-level resource deletion; some cleanup