remove "using namespace std" and cleanup headers
Merge tommis edits and clear conflicts.