nicer cleanup
works with nested sublevels