Added support for very basic error handling