Refactor code, add another test