refactored DualBuffer class