refacto path finding