Final version of the program