efficiency patch for the sa score code from Nick Firth