Added function and prototype for programLoop