Add framed operations (Max, Min, Avg, Change).

Had to make lexical_variable more robust against requesting variables
that haven't been created yet.