Dont know if above code can be made smoother ,

as takes a lot of time to run at moment

Merc