code refactor for child indexes