WP-609 Cleaned up and simplified the generation of the lead control panel