small changes to section 4, changed q_i