Add some API functions---fairly untested