Adding rate limiting function