replace conditionals with rotation computation.
extract variable.
rename direction to heading.