Added serialize() implementation