Earnest Money

What is supposed to happen with earnest money (placed in escrow with a title company) when a sale falls through due to the sellers refusal to abide by the terms of the contract? How does the buyer obtain their money back without going to court?
Once the title company is notified by the buyer who wants to quit the transaction, it will inform all other parties involved  - seller and  agents - of the buyer's wish. It will then ask all parties to reach an agreement and give instructions (to title co.) on how the earnest money should be disbursed.
When the seller and buyer agree on a solution and how to divide or not the earnest deposit, the title company will draw "an amendment" to escrow instructions reflecting what has been agreed upon by seller & buyer.
The title company will have each party sign a copy and will disburse the earnest money per those instructions.