V2

Outputting to a separate file, fixed input/output formatting, added
logic