Refactoring labels rendering for better performance and reliability.