fixed errors in code for Q1 and Q3