Moved a lot of code into tclib.