aded efficient factory method for heap