improve import script, fix bugs, more debug printing echo statements