Fixing array index issue. Commented for now. To be fixed later