Changed to a minheap