Remove orphaned sub-items from listings
Clean up code

Refs #39