Near the top of the program you set up a config line but it's commented out. I think for that chip to need to set the HS osc since you're using a 20Meg unit.

Do you also need to set the CONFIG register to set for oscillator speed and type?

I'm looking over the data sheet but have to catch it in fits and starts. More questions later.