Added option for error handler