Added the main functionality to the program.