#173 solution and added unit test with added test checks