using new optimization, added parallelization, changed W,Z to SharedArrays