Thanks Timmers that's a big improvement.

I'm using a pic 16F886 so can't use long variables sadly.

Anyone else any other ideas?