refactor global