fixed some possible bugs with string comparions
changed some comments