Heap for priority queue

The priority queue has now been efficiently implemented as a heap.

Unit tests exercise the heap. These can be run once using
$ make unit-test

The unit tests can be run automatically after every save by using
$ karma start