Added min/max heap functionality.