refactored the updater and added more totalling functions