Dealing with errors and rate limiting