Update unpack function