Corrected to write to output file rather than just STDOUT
Preliminary pileup support