added beginCapture() and endCapture()