implemented encapsulated rate limiting