heap with optional block for order function