Update class assignment logic