Add misc functions and tests

Export more functions.