Code cleanup and jslint fixes.