Added ability to take action after # of attempts, made slight fixes.