Flattened all parameters and variables to long format, plus other adjustments.