FIX ensure output is tuple of lists; fix refactoring