Remove debug function and pass the code through jshint

I removed the debug function because it was not used. I also passed the code through jshint and fixed the errors it was pointing out. This change also results in smaller minified file.