added support for array based input