Refactor CommandThrottler and add some unit tests around throttling