overhaul of dist.funcs