Was using wrong variable name for host.  Should have been 'ip'.
Refactored some of the code. File now passed in on command line.