find tree path and reorganise soruce code

Signed-off-by: 9drashijin <9drashijin@live.com>