Refactor unpacking files