Change the code order to make "Q" works

I create this PR to fix issue #5.