Understanding the main routine function