add config option for max attempts