Added unit test and functionality.