Add some more comments. Add some more logic to handle API call fails.