First batch of code cleanup, nicification, namespace wiping

Removing all `using namespace ...` directives to make the code
a) more compatible
b) less polutant

Also, replaced `for` loops with the correct versions when iterating over std STL containers, and removed old, unused (or commented-out) code pieces.
Second batch of namespace wiping, code nicification, and general cleanup