Since you changed this functionality, you need to replace all references to `direction` with `this.direction`.