Instead of making `direction` true or false, I'd make it 1 or -1.