refactor tuples conversion