move globals to top