Added functionality and test.