Improved class_wrapper