minor clean-up

add end/error callbacks
jshint