updated rate limit logic