Bucketing

This complets the implementation of bucketing