Program consists of the main function plus two other functions
Program was designed to avoid the use of global variables.