adjusted initial # of tries
some refactoring