refactored until NXQL part