Refactor max words