refactor bucket API