added serialize and deserialize methods