dms refactor