replacing substr and substring with slice to avoid confusion