Reimplementing importance sampling in the general program