added a reset function.