refactor with packsize