Code cleanup in exact inference methods.