Refactored 40 and added test case.