Code Clean up, try and move more code away from the main block
I don't get why I did this in the past.

But I now know that this is bad.