added offset, pagesize, weighting
removed redundant old code