Rewrite parameters, so that input parameters are first and output parameters last