Version5 and Version6 code