Set defaults all in one place
Remove unused variable.
Add more default values.
Use procid
Fix check for msgid.
Class name is a string, not a constant.
Ensure this is always defined.
Avoid issues with the use of arrays via magic __get() method.