#4 refactored