Added new function and tests.
Added new files. Forgot to include these in earlier commits.