refactor mqs