re-write tup_loop/scan as function; remove loop/scan_tuple