Refactor tuple unpacking