some fixes and first try to make the multi-instance part optional
Correcting variable
Update defines to use the optional multi-instance part