What were the teaching of Jainism based upon?