Refactors the code.