rewriting to support multiple value return without explicit lists