add support for function to return array