Improved serialization

Removes outside classes that assist serialization