Added manual double buffering