Refactor getObjectsAtPath.