Code refactoring for readability