Added mosts attempts and exit clause