Replacing distn4 by individual do_functions with .Call interface.