debugged initialize and findBucket functions