Added field xml elements to serialized object, and test to make sure right number of fields recognized. Also refactored tests so that test object is made only once for the tests.