1419 Fix issues found by Jerome
Refactor script to generate files for local and global brokers
Add templates for the local and global broker