Refactoring after code-review #4