Added tree recognition functionality