refactored unscramble