Add importance sampling code.