Moved serialization into its own file. Structured serialization/deserialization more effectively.  Fixed a few general-purpose build errors.