Updated Serialization

Fixed Serialization to work with more complicated classes