Improved resolution context factory, still need to test.