Added functionality and tests.