added function bodies for set direction and set logic
Fixed wont compile issue(variable name mismatch)