moving handling of external links into tools lib, implementing in popup