change order of pop and rest