Solve problem 2, kinda ugly