Refactor message types to improve readability
Fix flag mask values
Update demo script to use new function names
Add test case for overlapping flags
Refactoring and documentation