Original code didn't work with large file (no check for size overflow in several places) and didn't align chunk size to file chink size.
OK, I'll simplify code.