Added naive C version