In Patanjali's comments on the niyamas he speaks on religious action, kriya, bringing about samadhi and attenuating the kleshas. We think we have to be detached from that which we are attracted to but we also need to overcome aversion. It's easier to be finite, to have a past and a future than to be infinite, without past and future, so, we're clinging to life. The kleshas are the root source of karma. Quiet mental activity produced by the kleshas through meditation and achieve santosha, peace of mind. "Men of discrimination see sorrow in all experience."