Solving Problem 18 - not finished yet.