beginning of parallel implementatiion