Marc added error handling