Refactoring of platform-specific code