Refactoring after code-review #3