Moved common pack/unpack code into special header