refactored solutions