Glad hes doing better, my money is on the rock with a bunch of holes you removed being the main culprit... all kinds of junk gets trapped in those and leech out over time. On the up side your filtration seemed to handle it just fine.. just alot of nitrates resulted. i would continue to test over the next few weeks to make sure you dont get a mini cycle just to be safe. its unlikely but always best to ere on the side of caution. i would not put that rock back in, but a peice of driftwood he can pick up and decorate with might keep him and you amused.
you might want to start adding peas to his diet as well, and dont be afraid to try defferent brands of pellets. just like any other pet a little at first. should help keep it from happening again.