Added pattern mode, load from command line, maxtries