Removed dodgy loop attempt.  Trying again...