refactored database import using threads.
Removed unused code.