Refactored 49 and added test case.