added reset logic