Implementation of Leaky Bucket algorithm