#3 implementation and test.