more work, mostly changed the inverted xy2ijk function