Removing dev code
Reordering for readability
Refactoring for more functional programming

Seperating things out instead of having a big huge single funciton.