added reset_counter function