refactor tuple_element