created a boolean flag to example program