Replace all use of substring with slice