* Add stats updating cloud function * Read stats from database on client instead of computing them * Improve logging for stats updater * Tidying up