Added Richs C version