Added paralelization to run algorithm over N cores