added thread.sleep to avoid rate limiting