built new logicwq
refactoring (in progress)