updated rate limit code