Simplify bool conversion stuff with some new functions and constants.
Add CondFunction and make the tests pass.