Improved score algorithm