Fix Jshint warnings; switch to then() for all even handling