can you just store `res.ravel()[0]` here instead of computing it twice