new version with better EOF and new pdf