Added chunk size and wait on EOF, changed to use logging