Don't advance the dates array twice.  Add dryrun option.