+1 on figuring out what's causing your pain by seeing a good fitter BEFORE you make your purchase. They will figure out what geometry you need and can usually suggest a selection of frames. (Working with an independent fitter rather than someone affiliated with a shop is probably best, since they won't be bound to the manufacturers they sell.)

Your Trek may have been fit to you as well as it's going to be, but that doesn't mean the frame is even close to fitting you.