modify document length implementation