making the program more modular by adding the reset function