For Each Key In mPointsLog.Keys
Log("key: " & Key ) 'Prints PTSLog_0
Dim TPTSItem1 As TPTSLogRec = mPointsLog.Get(Key)
If TPTSItem1.blnSynced = False And Key <> PTSLog_GetMainRecordKey(PTSLog_GetCurrentSequenceNumber) Then
lstSortedList.Add( TPTSItem1 )
Else if GeneralLib.GL_AIDTF_GetTimeDifference( GeneralLib.GL_GetDateTimeAsAIDTF, TPTSItem1.EndDate, GeneralLib.GL_DATE_DIFF_UNIT_DAYS ) > 30 Then
PTSLog_ViewContents 'Prints all elements in mPointsLog showing that PTSLog_0 exists at this point
mPointsLog.Remove(Key) 'Causing a crash: java.util.NoSuchElementException for PTSLog_0
End If
Next