fixed q3 code, completed q9 and q10 code