Fixed issue of sorted tasks being increased by 1
Improved score function