Add option to limit number of attempts