Remove duplicate variable names and fix whitespace