Defiantly need to make the terms watertight.
At this stage it'd probably be more worthwhile for you to lawyer up and use the IP leverage to get them to pay your consulting rate (itemize your statement for time spent, even if it's an estimate).
A lawyer will probably advise you to send a last invoice and then a week later a C&D. It can be quite persuasive along with letting them know that next steps are alerting their accelerator to the IP that you own, and then the possibility of a lawsuit.
If you have enough documentation and the case looks strong enough a lawyer may even agree to work with you on contingency.
[Technically the accelerator would be well within their rights to sue as well since it's pretty obvious they didn't disclose there was an ongoing IP issue with one of their cofounders.]
Unfortunately, the cost of hiring a lawyer to do this is probably several hundred dollars (at least), which may well not be worth it or feasible for you right now. If they're in an accelerator, they may have the cash to pay you. Sure, you'll kick yourself if they end up billionaires someday, but you can be certain that they'd have found a way to screw you if you'd taken equity instead.
Fuck them over by drawing it out in court until the market opportunity dies. While it's going through court, open source it, and make sure every potential investor knows about the court proceedings.
If they go ahead without the IP, and rewrite, then they shouldn't pay you for it.
You've tried to play nice, its lawyer time now. Get the lawyer to post a letter, you can probably pretty quickly agree to a small equity stake, such as 3-5%. That's a small enough amount that they'll just agree to it, a large enough number that it'll pay you off if the company goes somewhere. It seems roughly fair for the amount of work you put in.