yet to be optimized path search script