all the function now use tuples as input/output