added support for returning arrays