Altered to use functions in util library when opening file handles to allow for files directly read from and written to HDFS (luckily HDFS supporting some piping)