Refactored 39 and added test case.