You can just `return dirIdx > 1` instead of an if/else statement here.