Add multithreading for better performance