move platform logic into platform