the termination condition seems to work
commit before adding pqueue