added functions to implement mi selection.