Also, as a freelancer I don't lawyer up for every single contract. Now I work mostly for an hourly rate, and usually for big clients that pay reliably, on a standard contract that I don't get a lot of say in (there are always some details that I address, but I don't get to write my own contract). So in a sense it seems unreasonable to expect up-front lawyering with extremely restrictive clauses on regular freelance projects.
Is the insecurity around startups the issue? Maybe working for a startup does require more lawyering. (My only non-payment came from a tiny 4-person outfit. Too stable to really count as startup, I think. Only resulted in $700 damage, though.) I guess at the very least the contract should contain a clause that the code remains yours until you've been paid.
My disbelief comes from the fact that this was a large contract worth more than $25,000 ($25k outstanding balance, with previous payments having been made). It is incredibly naive to allow an account to go $25,000 in the red, without having a lawyer ready to jump on board.
However, let's not make a mountain out of a molehill. The lawyer may be good with the use of the sledgehammer of the laws but they will probably not be good with helping you navigate the "inter personal" ends specific to your situation.
Btw, I have worked contracts larger than 25K without a lawyer and using the client's "master contract". I always review carefully clauses that concern me the most: ownership of IP, payment schedule, breach of contract, termination of contract, damages.
For my own consulting business, we have had disagreement at times (IP, amount upward 100K) but all were sorted out just fine without lawyers involved.
And when I represented Fortune 10/100 company, I have resolved 6-7 digits issues without lawyers just fine. However, when you represent Fortune 10/100 companies, things tend to be easier :)
In your case, try to work "inter personally" to get your 25K or even see if those 25K can translate into "credit/equity" that may give you a "slice" of the liquidation, if any. Talk to a lawyer about this one.
In Netherland, this actually works. I've been working for my current client for two weeks now and the contract has only just been signed. We can do a lot in contracts, but I can't accidentally sign myself away into slavery. I can't be expected to work for no pay when I'm not the one who fucked up.
And in this climate, $25k outstanding balance is not that unusual; I invoice monthly, and the client usually has a month to pay. So with $10k invoices, by the time the next invoice goes out the door, it could be $20k. Though in a jurisdiction with less legal structure and protection, I can imagine monthly invoices would be way too risky. But even then, if your invoices, are bigger, you can still easily get into this situation.
But again, it strongly depends on where you live. What's totally reasonable in one place, could be insanity in the next.
having said that we will be taking major retainers and updating our contracts so they are bulletproof.
You should have had a lawyer on consult from the beginning, reviewing the initial contract and its payment terms. If the client isn't paying, you need to be talking to your lawyer. If you don't have a lawyer and an ironclad contract, the entire situation is a toss-up and there are no guarantees. You can't even refuse to deliver and walk away from this client without a lawyer's determination that you are not breaching contract by doing so. You believe you are the one being wronged. The courts may not agree, and the company could even turn around and sue you for taking their project hostage.
Only your lawyer, with knowledge of your state's laws, a copy of your contract, and an archive of all communications between you and your client, can help. Do not make a single decision based on HN comments, no matter how insightful they seem. If you follow the wrong advice, you could well see yourself in deep legal trouble with ramifications worse than losing the $25,000.
tldr; You should have had a lawyer at the start of this contract. If not, you must get one now. Get a lawyer. Now.