Added max_weight to gen