You started a new job a couple of weeks ago, and at first, you were excited about it. But after spending some time at your new workplace, you feel that you can’t continue working there. Quitting a job right after you’ve started is definitely not ideal, but when the new job makes you miserable or you can’t meet the employers’ demands, it may be necessary. You now face the tricky task of walking away from your employer without burning bridges. Here’s how to proceed.

Be prepared for disappointment

First, realize that your manager will likely be very unhappy that you’re leaving. Finding a new employee is expensive and time-consuming. In 2016, it took employers about 36 days to fill an open position, and the average cost to hire an employee was $4,425, according to the Society for Human Resource Management. Your manager will probably feel that the effort spent training you were wasted and that you shouldn’t have been hired in the first place. Try to accept this fact before you announce your departure so you aren’t caught off guard when your manager reacts poorly.

Tell your manager

Meet with your manager, and make your announcement right away. Don’t try to postpone the bad news, because that can make the conversation even more uncomfortable when you finally mention it. Say up front that you’ve found the job to be a bad fit for you and you’ve decided you need to leave the position.

Your manager may be pretty upset. Try to stay calm and acknowledge that leaving so soon after joining the company causes problems for your employer. Apologize for causing this inconvenience, but don’t beat yourself up or try to defend your decision. Although it may not change your manager’s attitude during the conversation, he or she may later look back on the experience and realize that you were respectful and handled a difficult situation well. That opens the door to possibly having a good working relationship with that person at some time in the future if your paths happen to cross again.

Be careful not to badmouth anyone you worked with during your short time with the company. That would cause unnecessary hard feelings and would likely ruin your chances of being on good terms with this employer. Even if you are leaving because of a personality clash with a particular coworker, don’t give in to the temptation to point a finger at them.

Give two weeks’ notice

Tell your manager that you will still be available to work for the next two weeks. This shows that you respect your manager and the company and you are giving them time to find someone to take your place.

Don’t slack off just because you’re leaving soon

Whether your employer will want you to actually keep working for two more weeks depends on the type of job you have. Sometimes, companies don’t want a person who has a foot out the door to continue working. But if you work a shift that’s hard to fill, your employer may need you to come in for the full two weeks because hiring a replacement sooner just isn’t possible.

In that case, continue to put effort into your work and to adhere to all workplace rules. Don’t cut corners or do subpar work that someone else will need to correct or deal with later. It may feel pointless to work hard at a job you’re about to leave, but you never know if you’ll run into the same manager or coworkers at another job somewhere down the road. You want to maintain the respect of everyone you’ve worked with.

Stick to your decision

Your employer may try to get you to change your mind, especially if they’re understaffed or you have some valuable skills. If that happens, you should politely state that your decision is final. Hesitating will only drag out your departure, which isn’t good for you or for the company.

And if you say you’re going to leave and then don’t, your coworkers and manager likely will think you’re unreliable or trying to create drama at work. It’s better to make a clean break as soon as possible and move on to a new job where you can be successful.