The treatment of insomnia depends largely on the cause of the problem. In cases where an obvious situational factor is responsible for the insomnia, correcting or removing the cause generally cures the insomnia. For example, if insomnia is related to a transient stressful situation, such as jet lag or an upcoming examination, then insomnia will be cured when the situation resolves.