Tao s function helpers

Merging in additions by @tao-s.
Adding tests.
Making some adjustments to the interface.