Refactoring of rules expression ast builder and test cases