Added capture_stream method