added null check
added stripRedundantFormats method to ChatFormat

also added UnitTests for ChatFormat