began working on path-finding function