Bug fix for first chunk overshooting the end of the slice

Hi there!

Thanks for creating this little utility, I was wanting something like this. Anyway, I ran into a bug where the first chunk delivered would overshoot the end of the slice range. These changes seem to have it cleared up. I changed some things for the later chunks just as well to make things a little clearer. 

Anyway, hope this helps, let me know if there is anything that isn't kosher.

Best,
Bill