Passing data.  problem with end condition