Made buckets to be always in even numbers
Adjusted code to do upfront caching