Copied new platform detection code