Solved problem 7, w/ documentation, needs optimization