First try at expand/contract for functions and arrays
Added expand/contract for functions and arrays