Added serialization to facilitate storage on disk