Improved legend update