completed refactored solutions