And if you fulfill your Dharma, things improve and you get reborn into a higher being. You don't have to scoop elephant dung anymore. But the ultimate goal is not to be reborn as a Brahmin. The ultimate goal is to be released from the merry-go-round altogether. And that release is called Moksha. The law that holds all this together is Karma, which is summarized really nicely in the Aranyaka Upanishad. The doer of good becomes good.