worked on path algorithm