aw22 rule 8.7.1 -> update testcases and improve algo