Implement remove-empty-parties feature