working parallel implementation that is twice faster than sequential