Rewrote module in C99.