convert to use arrays of stack frames for input and output

Allow environment differences in getting frames to be left to the user