more improved double-buffer logic.