cleaned up q2 code