Attempting to generalize minheap; has bug/segfault