added option to find path to closest node possible