Refactor accumulator optimizer