Update wmf.c

Completed code. Cleaned it up.