Working madot

Added csv header, fixed print order bug, set file name