Refactor a code