Coding the main function