Refactor the rate limiter to ensure that it performs as intented.