refactored and made separate solutions