you have resetBucket defined twice.. I'd get rid of this one, and keep the top one since it's with the other bucket operations