Added support for older ie browsers by not using indexOf, which doesn't exist for ie8