added support for array of endpoints