#3: refactored