This is bthe 1st version of the code