Refactored alot of ugly JS code and finalized device tooltip