optimised (by adding totalEntries)