first working version of rate limiter