Timer code replaced with a more portable threaded version.