Refactor global