remove global defined startsWith call and replace with index of