Adding functional, but slow solution to problem 3.