Updated script for auto-reset.