Sixth problem
Seventh problem
Eigth problem
Ninth problem and cleaned up some previous code