Move function modified and GetNextTile added