Refactored a bit of tooltip window. Added hack to fix #540 note this should be fixed better