added getBucket to 2D bucket and refactored code a bit.