Moved reset logic into separate method.