working on issue that causes direction to become NaN