added error handling capabilities