refactoring to improve context load