Refactoring the context object