Added resize to loading screen

Refactor to move all calculation logic into a separate function