added support for $from to be array of inputs