Added dispose method and changed string compare method

I implemented a dispose method so that I can use it to dispose any held
loop easily. I implemented best practice for comparing strings: the
String.Compare(s1, s2, StringComparison.Ordinal) method instead of the
s1.Equals(s2, StringComparison.Ordinal).