Add double buffering mechanism