Removed problem with direction[X] == 0.