changed ev_idx to ev_mask