custom code for ArcGIS JavaScript API