find terminal path implemented