refactoring to use an injected contex in methods which need no knowledge of larger class.