bring updateQ and updateP into main class