Refactoring to eliminate redundancy in output class hierarchy