Second Version with Multi-Threading Capabilities