Fixed column names and lacking closed parentheses
Streamlined by removing intermediate results