add error handling.