Solved 8 - 10. Optimized 7 from the solution to 10.