refactored platform code into its own class