Easy fix for flickering lights and side window settings

I have struggled for years to find a fix for two nagging electrical problems in my 2006 XK8 but finally fixed it. I have had flickering lights and occasional drop outs of the Xenon headlights plus frequent almost daily loss of side window position memory. I replaced the battery with a new one and both these problems are now fixed. The battery was the original Varta (Made in Germany) battery and was almost 13 years old but was still giving me good starts even in cold weather. One morning last week it died so I replaced it with a new Bosch battery from pep boys and presto problems solved.