Added comments and ability to write to file