Add: improvement to the handling of empty container types;
Add: more checking for variable initialization;
Add: a few minor fixings and simplification.