Refactor the changed transaction detection and improve the accuracy