Changed a large number of functions to take tuples rather than curried arguments.