rename to better filename, added output file functinality.