Refactor class hierarchy and import statements.