refactor logic to handle array AND non-array DI syntax