Changing "Switch" in color class to "if..else"