Fix bug with first chunk overshooting both the start and the end of the slice. Also some small variable changes.
Merge pull request #1 from bilhamil/master

Bug fix for first chunk overshooting the end of the slice