Refactored then event bucketing lib.