Overhaul item stack serializer and deserializer