add flatten_details for a better separation of classes