I was messing around with Eddie's suggestions and input them into MuseScore to see how hey worked. I'm uploading mp3's that were generated and the pdf of the score.
The first one follows Eddie's suggestions except for measure 19. That just didn't seem to work. But, as I was looking at it, if the bass Eb D Eb in measure 20 was moved up a 3rd to G F# G the D major now acts as dominant. It arrives at an ambiguous Bb D which is clarified upon the entry of the G in the bass as Gminor, this morphs into an Eb on the next beat as predominant to the F7 - Bb cadence.
While the sequence in measure 13 and 14 works with Eddie's suggestion, I rather liked the repetition of the melody as you had it. So, in the second one, I left the soprano the same and simply moved the bass down a 3rd. This is also consistent with measures 17 and 18 which maintains the soprano but moves the bass down a 3rd.