Refactoring context to use functional obj construction