Made dist and wdist into functions

There's really no need for them to be lambdas, is there?