added sync double buffering