Added negative scan increment compatibility

And moved duplicated loopwise incrementing line