sped up unix c version by 2x