Writing the program