Handling threads better in path import