Replacing distn3 by individual do_functions with .Call interface.