fixed jshint warnings and made library ie8 compatible