When you go through a divorce and have a business, there is sometimes no question that you want the business to stay operating. If you and your spouse are both in agreement that you want to remain part of the business, then there is no other option than to work together in the future.

While the divorce can take your time away from the business, it’s possible to maintain it well and to work together with an ex-spouse to run it. There are some benefits (and downsides) to doing so, but if you’re able to put your business first, this can be a good choice.

1. Put together a contract, now

Before you continue working together, it’s a good idea to get a contract in place. You’re no longer married, so you need to establish each other’s interests and share in the company. You need to have dedicated roles to fill as well. In some cases, if you choose the right positions, you may not even see one another despite working together. For example, two CEO executives may travel for work often and only have to email or call to confirm deals.

2. Establish ways to resolve conflicts

You should establish ways to resolve conflicts between yourselves before ever working together after divorce. In your contract, you can state that a third party will resolve conflicts or that you’ll attend mediation regularly to work on your business relationship. Whatever you do, don’t leave conflict resolution to chance.

3. Plan for buyouts

If you do find that you both have trouble working together, it might be in your best interests to have a buyout plan for you and your ex-spouse. This plan should include what happens if you want to buy out the other party or if they want to leave. What will they take with them? How much money will they receive? These are all things to include in the plan.

It can be difficult to work together when you’ve gone through a divorce, but if you and your ex-spouse work well as business partners, it could be the right choice for you. If you put the right safeguards in place, you can make sure that your past together won’t continue to influence your business in the future. That’s the only way to guarantee that you can work together without complications arising from the relationship you had as a married couple.