first dsraft of main.cc
making some io changes to main.cc