refactored class hierarchy