extracted usefull methods from problem1 into LogicEngine so I can
re-used them later.