replaces use of indexOf with more idomatic CoffeeScript