refactoring q1 and q2