Changed nextDirection to translate coordinates.