Refactored 38 and added test cases.