added comments to prep_q_encoding()