second version, windowed