Made functional WBT.

Re-wrote and cut down the WBT code.