Add script metadata header
Find variables defined in function parameters
Better support for function parameters and globals