remove end and initialize Q