Refactor a little bit in LogicTest