Move the bucket manipulation into the KBucket class.