refactored subclass attaching