Fixed it.  Works properly in C now