Added a couple of functions and a relevant test.