Refactoring codes: pages -> weight for word