broken version using indexOf for comparison