It can be done, and done well.

Leaving a job can be incredibly nerve-wracking. Lots of thoughts are probably flashing through your mind, many of them scary: what if Im making a mistake? What if they fire me on the spot? What if my boss resents me for my decision?

But there’s a way to quit a job that can leave you and your past employer feeling positive about one another. Here are a few tips for leaving your job without burning bridges so that as you move forward in your career, you maintain a connection with the people that helped you get to where you are.

Give as much notice as possible.

The rule of thumb is to give your employer notice of your departure at least two weeks before leaving; never give an employer less notice than that. But if you’re able to give a bit more, that can be helpful. For instance, if you’ve just landed a new gig that’s going to start in six weeks, and you know you want a week off in between, you could give five weeks notice so that the transition is as smooth as possible. It will probably take longer than two weeks to get a new employee started in your position, so your boss will be grateful if you can stick around for a bit.

Offer to help find your replacement.

Can you be part of the process to find your replacement? By offering to help find a new employee—or even begin his or her training process—you can take a lot of weight off of your employer’s shoulders. Often, the most stressful part of an employee leaving is the amount of work it will take to transition to a new one. So anything you can do to help that process will likely be appreciated; it also shows that you still care about the mission of the organization even while you’re moving onto a new one. You could offer to sit in on interviews, write up your job description, or even vet potential candidate applications.

Tie up loose ends.

Try to avoid leaving in the middle of a large project. Finish out whatever you were working on as much as you can so that your replacement isn’t completely overwhelmed. You don’t want a new employee to come in in the middle of things—it’ll make for a tricky hand-off.

Leave detailed instructions and advice for your replacement.

By typing up a detailed list of your responsibilities for your replacement, as well as any tips they need to know, you’ll make the transition that much easier. Whether it’s the company Instagram password, details about your top five clients, or even which days the food trucks park outside your office, making your replacement feel comfortable is one of the best things you can do when transitioning to a new career.

Don’t bash your employer.

Even if your boss treated you less than kindly and you’re happy to be leaving this particular business behind, being graceful about your departure can go a long way. Unless you’re specifically asked why you’re leaving when you give your notice, refrain from any complaints and save your feedback for your exit interview. Also, avoid bashing your former employer on social media—no matter how private your settings are, those sorts of posts have a way of getting around. You never know when you may need something from them in the future, and it’s just not a good way to leave things.

Send a handwritten thank-you note.

Whether your boss was a beloved mentor or a thorn in your side, writing a thank-you note demonstrates your appreciation for the company that gave you a paycheck and helped you along in your career. It’s a small thing that takes less than five minutes, but can make a big impact. By thanking the company you’ve left for all they’ve done for you, you’re moving forward while showing your gratitude and keeping a firm connection in place.

Leaving a job doesn’t have to mean burning a bridge. By making things as easy and foolproof as possible for the company you’re exiting, you’ll start your new job off with a calm peace of mind and your former coworkers still in your network.