Revert "modified RuleTillEnd"

This reverts commit 49b6c03fc30231c06d5443980f018e21f733a0d0.