Added error handling support and short circuting when errors occur.