Clean up normalization logic, but it's still not quite correct