Switching to callbacks for inspecting source. Also, fixing broken tests so that have better mock optimizer context and cache