Changed some ndindex stuff