Added automatic error handling.