Adds internet check to dbimport script
Lots of refactoring