Added proper 'end'  for Naive version.