template for heaps