extract score function and last page