Thanks for the PR! Not your fault, but I think it might be sensible to avoid duplication at this point by just computing non-reverse and then at the end having "if reverse: result = not result". What do you think?