No more globals, moved functions around, just cleanup.