Problem 7 more or less completed. Seems to work correctly just need to
verify and possibly add comments.