Fixed trivial things like spacing and newlines, ensured compilation on OS X 10.8.2, fixed other stuff