Fixed totals in compare function
Works better offline