Fixed message buffer

The `i` variable got removed in f190dc1e0d42a58944b235e288cdf68cfb52a50a. The compile issue isn't fixed.

See 36f85f7 to see the changes needed to fix the compiler error. The rest of the commits are mostly white space changes...