Introduced multi-threading for better performance