rewrite buckets for performance