implementing new path finding alghorithm