Ported the packer to C++