Remove trailing commas, extra variables