Changed VAR to NEW definiton.
Added invalid function handler.