Refactor package_mac