Realized the program needed better structure for further improvemtns. i.e. for the program to run recusively