Ultimately if neither party is bad then the contract aims to set expectations and clearly outlines what each party expects. But....
The moment you have to "enforce" or "defend" a contract you've essentially lost.
Do you trust the other party? If not, then no contract will save you.
The other thing I strongly suggest is to limit the amount of work you do prior to getting paid. You should keep a slim amount of work (none, if possible) that hasn't been paid for.
Always think in worst case scenarios and assume anything that's completed but not paid for can be withheld.