a few small style changes
replace all use of std::endl with "\n"

std::endl calls flush as well as ending the line.  That can create huge
bottlenecks if called too often.