If you perform the previous cleaning steps, you should be able to eliminate the flickering problem. Last but not least, check both 123 batteries. If any of the batteries indicates anything under 2 volts, you have found your problem. You need to leave the light on for several minutes, and remove to test them immediately. If you allow them to sit without a load, they can recover to about 2.5 volts within about 5 minutes.
The flickering problem gets worse as the batteries go down. My problem got really bad after one of my batteries measured 2.4 volt and the other was at 1.7 volt. The X-5 went well over 20 hours of run time before the batteries went down this far.