Default history to today. Clear table when changing day. Make stats logic more robust