added stop_capture function