Fix all global variables + preprocessor directives

Group together from all over the file and:
* Rearrange by category
* Sort alphabetically