Refactored the resolution vs context system a bit.