Minor changes to a variable name.
Changed the wait time before trying to set direction and edge.