Added support for error handling