globals and vars reordered (to get tests to pass)