Potential solution #1 for problem 1