Refactor the code block