Refactor some checks into globals, resort others