made the result type as an array of Res just like in the paper