Thankyou very much for the replies, I will look into bit functions and operators as suggested.
Also, thankyou tmd3 for using examples that I can actually follow in my code, I've seen all too many people of my experience become completely confused by replies as they don't see how it fits into their problem.
Sam