Fixed hanging issue

Fixed the main hanging issue with the script.  The script should no
longer hang on records anymore.