Revised function sor_heap() so that it only takes S0 and N0 as inputs rather than the observed SAD. A new function was added sor_heap_fixed_sad() that carries out the same calculation only with the observed SAD.