Simplify arguments to edit_distance routines.
Moved memory freeing out of Perl's influence.