changed logic for SMS. Used SparseArray.