completed first version of path-writing functions for mapper