Removing var assingment from loop and calculating buffer length outside ...

Removing var assignment from the loop and calculating buffer length outside the loop. This gave me about a 30-40% performance boost when running a profiler.

I also have no-whitespace-at-the-end-of-lines on by default, so those were removed too. :)