Divided the "pack routine" and "unpack routine".