Now uses threads to process images