PWM Atmega644p

I am using this version of Marlin:

in order to replace the less than usable electronics in my Chinese laser cutter.

This version uses motherboard type 33 but I am trying to use an Azteeg X1 (Motherboard == 6), it is going reasonably well.

This version of Marlin is using soft pwm and it is really low frequency. I have managed to bluff my way through a bit in order to use pin44 (D4) for the PWM and it is coming out at 977 Hz, this is all as I expected but I need it to be 20 kHz or so and cannot find anywhere in the files where I can tell it to use a higher frequency. I cannot find any defines for the timers at all and I can’t really understand the data sheet for the 644p and C++ is like a foreign language to me.

Google gives me some bits of code for PWM on other Atmegas but it’s all a bit abstract for me.