Added coding methods for serialization.