Refactor and add another test.