More cleanup: use wtf functions when possible.

Please take a look.