Refeactored the platform main file
Huge refactor