40Mhz is used to increase the speed.
Problem is that 2.4Ghz is very polluted ie plenty of devices.
And with 40Mhz you are asking to double the bandwidth, which you usually do not have available in the 2.4GHhz area.
2.4Ghz got 3 none overlapping channels and you are basically asking to use 2 of those 3.
5Ghz got lots more channels, I do not remember the exact number, but there 40Mhz works better.
EDIT : 23 Channels in 5Ghz
"Perl is executable line noise, Python is executable pseudo-code."