Changed queue to a priority queue, increased max recursion depth