In my workshops, whenever I ask delegates as to how long they want to live, the answer I get from most of them is 60, 70 or 80 years. While answering they forget that they are only talking about the death of the physical body but what about the mental, social, intellectual and spiritual bodies.
It is well known that the soul never dies and so do your Sanskars and good work done. The aim of life should be that one should live even after the death of his or her physical body. It is your good Karmas, which keep your memories alive even after your physical death.
It is equally true that your bad Karmas too can make people remember you after death but that is not the purpose of life. We would like to be remembered as Rama and not like Ravana after death.
In Vedic language your present is decided by your past and your future is decided by your present. To improve your future you need to work positively in your present.
When you start working positively in your present moment, you will start neutralizing your bad karmas. It is like washing a dirty shirt which will not become stain free in one washing. Only with repeated washings can it become stain free. Similarly washing away your bad karmas with good karmas will take time.
It is possible that even when one starts doing good Karmas, one may still suffer as the sum total of past karmas may not have been neutralized by that time.
For example, if a dacoit surrenders and wants to live a civilian life he may be pardoned to some extent but may still be jailed for some duration of time. In other word he may be pardoned from death sentence and given life sentence.
As per Bhagavad Gita, whatever your thoughts are at the time of death will decide the atmosphere you will get in your rebirth.
It also says that whatever will be your thoughts throughout your life will be your thoughts at the time of your death.
So do not expect that you can acquire positive thoughts at the time of death if you have been thinking negative throughout your life The gist is to start doing good actions in the present.