Initial attempt at the threading code...