Refactor the code.