Function upgrade to support more blocks and array of same variable name plus style update