DRY, code refactoring