obtaining parent_id was expensive so use this optimization instead