I don't think it's a coincidence that the multiplatform codebase was cleaner. Very often, things will be written quickly and then you have to clean up a lot of the technical debt as part of porting it.
Your assumptions about the compiler/interpreter, file system and so on often break across platforms, so you have to revisit and repair that code as part of the porting process.
Quoting from "The Practice of Programming" by Brian W. Kernighan & Rob Pike:
Finally, and most important, a portable program is a better program. The effort invested to make a program portable also makes it better designed, better constructed, and more thoroughly tested. The techniques of portable programming are closely related to the techniques of good programming in general.
Your assumptions about the compiler/interpreter, file system and so on often break across platforms, so you have to revisit and repair that code as part of the porting process.