Refactor unpack