restructured heirachy to fix infinite loop