Some refactoring. Also started validating the SCO by looking for imsmanifest.xml and verifying it's actually XML.