First working version. Still some more work to do.
Some tiding up.
Added the chunk size as a command line parameter
minor changes to comments