few code cleanups

removed unnecessary casts
replace String.indexOf with String.contains