it is believed that if you were a perfect person, you would spend the after life in the form of a human. if you led a bad life, you spend the after life as an animal. this encourages people to be as good people as possible.
If you are bad in you're first life you will be reincarnated to a lower caste
Good and bad behavior related to reincarnation by, if you were a good person you would spend the after life as a human, but if you were a bad person you would be a animal when in the after life.
so what