now with error handling