logging and moved add_class