working reset button and automatic reset on win