Updated score calculation to cache scores when value already exists