Simplified conditions checking for elements to insert into tooltip.
Fixed the tests.