q is calculated twice. We should reuse it
q is calculated twice. We should reuse it