Neonmadman,
Genesis 4:2-7:Now Abel kept flocks, and Cain worked the soil. In the course of time Cain brought some of the fruits of the soil as an offering to the LORD . But Abel brought fat portions from some of the firstborn of his flock. The LORD looked with favor on Abel and his offering, but on Cain and his offering he did not look with favor. So Cain was very angry, and his face was downcast. Then the LORD said to Cain, "Why are you angry? Why is your face downcast? If you do what is right, will you not be accepted? But if you do not do what is right, sin is crouching at your door; it desires to have you, but you must master it."
Just wanted to comment that I think you are reading a lot into the portion you highlighted. It's tempting to mentally expand "if you do what is right" into "if you [Cain] lived a righteous life instead of the life full of sin you have been living." But there is no evidence or indication of any wrongful living or any specific wrong outside of the difference in type of sacrifice. For Abel we do get the extra information: "But Abel brought fat portions" which we probably do have the some right to expand mentally as "the best, fattest, choicest portions." Whether that gives us the right to decide that Cain, on the other hand, must not have given the best portion of his vegetables, I don't know if we can really say. It's a pribable implication. However, I'm just thinking that the extra evidence you seem to have read into "if you do what is right" doesn't appear as valid.
For me, this reminds me of how I always used to read, especially these Genesis stories, with a need to make them square up with the rest of the Bible, and so I'd fall for the temptation to add to them whatever is needed so that it fit what I think about the rest of the Bible. (That's still a valid way of reading it, of course, for people who read the entire Bible as a single story and therefore can consider any of it as part of the context.)
"If you do good" (a simpler translation) could just as well expand to, "if you were to give fatty meat instead of vegetables" from what we know in the immediate context. This makes God appear capricious and arbitrary without a "Mosaic" context of "blood sacrifice" and "fat sacrifice". It also makes it look as if God is the one purposely pushing Cain over the edge, pressing his buttons, to prove that Cain can be driven to act on uncontrolled passions from within.
We have very few choices from context if we wish to soften the story. If we are OK with the "capricious God(s) genre," then we are free to discuss any number of reasons this story was told, remembered, and recorded. Historically, it makes sense that a collection of old Jewish stories would include the conflict of the nomad culture and agri-culture. (see Rogers' and Hammerstein's Oklahoma.) It may also make sense that some priestly collectors wanted to include the story because the Temple "priest-as-butcher" culture was being ignored in favor of the new ideas in Hosea 6:6 and Micah 6:6. ("God wants mercy, not sacrifice.") Perhaps the priests, who kept a tenth of what they butchered, thought they weren't getting enough meat in their diet.
For me, it appears to have been saved for several possible reasons, but it also fits the capricious God genre that we see in other Genesis stories: e.g, the Garden of Eden (we better not let them eat the the tree of life or they will live forever), Flood of Noah (God got to see that it was bad so he flooded it/God got to see that what he did was regrettable so he promised not to do it again), the Tower of Babel (if we don't stop them, there's nothing they won't be able to do). Other cultures, including other ancient Mid-eastern cultures are famous for collections of "capricious God(s)" stories.
My 2 cents,
Gamaliel