Lead popups formatted using SQL

Fixes #232, Fixes #207, Fixes #140