efficient packing method