Changing `$this->result_pids` to an associative array mapping PIDs to PIDs (or just `TRUE` possibly? Bit of a space saving?) will allow you to use `isset()` instead of `in_array()` for a bit of a speed up...  Would also replace the `$this->checkRecursion()` bit.