Reworked some loops in heap-sorts