Re-Ordered Functions

No actual functional change.
The order that functions are implemented is re-organised as to be closer
to the order that they are called, allowed for easier reading-flow of
the program.