implement poll properly, add test for heap sort