Rewrote serializer. Needs serious refactoring.