Modfying to handle commandline args better, and support pretty printing