Fixed StructureSet and added a bunch of tests