Added setClassIf method