add double bufferd code: wait to be tested