Added some comments to the code
added csv mode checkbox