More cleanup. Change array type from Expr to Any since differentiate can also return Numbers