Move normalizePlatform() out of exported function