bucket refactoring