added a bucket and collision detection