#2 implementation and test.