optimize the input to skip unnecessary pages