added TODO
switched from inRange to should_increment

allows to put test for end in function. I'm a little scared to be
relying on global-ish variables - but it looks ok.