Factor out non-bucket functions from Bucket.