clean references and add page counts