imported from heaps