Fixed threading problem and now allows files with spaces in them