Refactor solutions for problems 23-25