refactoring global object