Does anyone use a marble jar as a reward system for good behavior? Do you take some out if they are misbehaving? How do you determine what earns a marble and how many marbles are needed to earn a special prize/treat?

I'm looking at doing this with my preschooler, but I'm trying to figure out how I want to work it so she understands, and the rules are laid out beforehand.