Added unit tests for the "if" function.
 Additional cleanups in the API visible to extension developers.