added most of bucketing