first version of edit path routine