Added unit test for function