Changed add_class and remove_class to use messages instead of stateful communication