Update UI, improve history management