Improved string concat and general clean up

This reduces the string concatenation Ordo
from O(n^2) to O(n). I also cleaned up some
to make JSHint happy.