reformated and added an empty array check for incidents