Making subpart adds code more testable, and adding tests for new functions