There’s a story that illustrates the near-universal response to pay inequality—frustration—and it involves monkeys and grapes.

It comes from the research of the primatologists Sarah Brosnan and Frans de Waal. Brosnan and de Waal were running an experiment involving two capuchin monkeys, in which both were instructed to perform a task—giving a rock to the researcher—in order to receive a reward. In the experiment, which was recorded on video, the monkeys were compensated with either a grape (which they enjoy) or a cucumber slice (which they enjoy a lot less than grapes). Because they monkeys could see each other, and see how they were getting rewarded, the researchers could test the monkeys’ reactions to unequal compensation by “paying” one monkey a grape and the other a cucumber slice.

The result? The monkey who got the cucumber slice was so outraged that it promptly chucked the slice of cucumber at the researcher, and shook its cage madly. This experiment has been hailed as proof that even monkeys are incensed by income inequality—so it makes sense that humans are too. De Waals, in a TED Talk that brought up the finding, jokingly compared the angry cucumber-slice-throwing monkey to Occupy Wall Street protestors.

Brosnan and De Waal’s video contains a deep truth, but the salaries humans earn are a bit more sophisticated than grapes and cucumber slices, so it makes sense that things are a little more complicated for them than monkeys. Human workers in the same office rarely perform the same tasks as the workers next to them. (Service jobs and call-center positions are some obvious exceptions.) And so for those office workers, fair pay might not necessarily be the same as equal pay.

“When it comes to fairness, when you take that apart in a little more detail, employees fully understand that some employees should get paid more than other employees. And they get that,” says Brian Kropp, the head of HR practice research at CEB, a research firm. Kropp’s company surveys thousands of employees a year on their pay levels and thoughts on compensation, and he says that people around the world for the most part understand that different kinds of work demand different levels of pay—it’s understandable that a CEO is compensated more than a middle manager, for example.

But Kropp says that what employees do have a big problem with is the sense that they’re being unfairly compensated in the great scheme of things. “The whole thing is dependent on whether or not employees feel like the process through which they got paid was fair. For example, they want to know that people who achieved particular performance scores, outcomes, metrics, sales, or quality targets—that there's fairness based on how rewards are allocated based upon what I did or what I didn't do,” explains Kropp.

Making compensation seem fair is tricky, but the stakes are pretty high: CEB’s surveys found that whether people felt their compensation was fair was 25 times better at predicting their engagement at work than than their actual salary. And another study found that the feeling that pay is unfair makes people consider leaving their jobs.

So how can compensation be made fairer (or at least made to seem fairer)? Kropp says that managers should have conversations with their employees about what good performance entails and what raises might look like in the years to come, as well as an open discussion about bonus criteria—which together can increase an employee’s perception of fairness by as much as 60 percent, CEB has found. “In order to have that fairness, it has to be a pretty transparent process. Otherwise, nobody knows what their performance looks like or what the rewards are that’s associated with their performance. If it's all hidden in a black box … by not having transparency, you can't have fairness because nobody knows what's going to happen,” says Kropp.

At least one company has reported positive effects from a version of pay transparency even more extreme than what Kropp describes: The startup Buffer has a publicly-posted salary formula and an online pay calculator so their employees can see how their pay is determined. Buffer’s co-founder, Joel Gascoigne, reported that after the publicity of the company’s focus and practices on fair-pay, the number of resumes Buffer received doubled and the quality of its talent pool shot up. Gascoigne told Quartz, “We’ve never been able to find great people this quickly in the past.”