Closes PR# 1170. Submitted by: James Raynard <jraynard@dial.pipex.com>
Submitted by: John Birrel(L?) changes for threadsafe operations