Started using OpenMP, which works ok but needs to be optimized more