More indexing changes in progress
For better or worse, changed all fmod(dim,2) to !=0, from ==0. Hopefully this will resolve the direction confusion