Added switchClass function