Made 'max_tries' configurable