the second algorithm

based on bcTable and textWindwo