Removed array.indexOf dependancy

Code should now work for older browsers.