Added helper functions for serializing.