Refactor globals