exam incident

Please correct this gramaticaly and help me to make it in advance level please

On the second day,On the way to the exam my dad’s bike got a puncture and took me a long to get a cab so I had arrived at the centre just 5mins before the exam.On the second last day they told us that the exam venue is changed for the next day’s exam.The new venue wasn’t far from the initial venue but the electricty kept coming and going during the exam.I never had such a tough time with exams in my life.

On the way to the exam on the second day, my dad’s bike got a puncture and it took me a long time to get a cab. As a result I arrived at the centre just five minutes before the exam was due to start. On the last but one day (the penultimate day) they told us that the exam venue was changed for the final day’s exam. The new venue wasn’t far from the initial venue, but the electricity kept coming and going during the exam. I’d never had such a tough time with exams in my life.

I’d never had such a tough time with exams in my life.this sentence is in past perfect tense ,right.Can you plaese explain me why we have used past perfect here.

The Past Perfect expresses the idea that something occurred before another action in the past. With Non-Continuous Verbs and some non-continuous uses of Mixed Verbs, we use the Past Perfect to show that something started in the past and continued up until another action in the past.
I had never had such a tough time with exams – before this exam (which is now in the past).
I had had an easier time with exams – before this exam.

englishpage.com/verbpage/pastperfect.html