Adding in error handling.