It may be a good idea to go through and add in some echos to test where the script stops.