Add better error handling.