Code Refactor

Fork
Improve the code by refactoring such that the result adheres to the current best practices and coding conventions. You may rename variables and split functions into pure functions. Do not change any values. ```[language] [code] ``` Please only provide the resulting code without any description. Reduce code duplication as much as possible. Let’s work this out in a step by step way to be sure we have the right answer. After all steps are complete, show full code.
Cancel