added stuff for heap sort