Added error handlers in addition to success handlers