Finished a very simple (and slow) solution to problem 2