Fixed slow canvas updating and corrected jshint errors