Updated C version