More polish on the search algorithm: switched to a max-heap, etc.