separated code for bucket into separate bucket.js