Removed unused imports; added serialization for extended classes.