Refactoring to remove explicit passing of packer and unpacker