Rearrange platform-specific code