Our code follows the Google C++ Style guide, please make sure this pull request follows that as well:

http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml

It is initially tedious, but really helps with readability. I will point out some things here, but if you have a chance do read through it.