Improved packet build script