add tbl_qarate and related functions