updated to display legend properly