Added a program loop and function choice mechanism