changed heap to take both a priority and a value