Ms refactor